/////////////////////////////////////////////////////////////////////////////
// Name:        wordswnd.h
// Purpose:     
// Author:      Brant Young
// Modified by: 
// Created:     Mon May 14 21:46:51 2007
// RCS-ID:      
// Copyright:   Copyright (c) daodict.com 2007
// Licence:     GPL 2.0
/////////////////////////////////////////////////////////////////////////////
#pragma once

#include <wx/splitter.h>
#include <wx/listctrl.h>

class CHMHtmlWindow;
#include "wordstoolbar.h"
class CHMFindToolBar;
class ThemeManager;
class ConfigManager;
#include "dictmgr.h"

/**
 * WordsWindow class declaration
 */
class WordsWindow: public wxPanel {
public:
    /// Constructors
    WordsWindow(wxWindow* p_parent);
    
    /// Destructor
    virtual ~WordsWindow();
    
    CHMFindToolBar* p_find_toolbar;
    WordsToolBar* p_words_toolbar;
    wxSplitterWindow* p_spltwnd;
    //ExplainWindow* p_explain_wnd;
    CHMHtmlWindow* p_explain_htmlwnd;
    wxListView* p_dict_list_lbox;
    

    void relayout();

    /// Control identifiers
    enum {
        ID_WORDS_WND = 10001,
        ID_WORDS_SPLTWND,
        ID_HTML_WND,
        ID_DICT_LIST_LBOX
    };

    void add_word_2_history(const wxString& word, int word_id) {
    	p_words_toolbar->add_word_2_history(word, word_id);
    }

    void show_dicts_by_word(int wordid) {
    	_p_dictmgr->query_dicts_by_word(wordid, p_dict_list_lbox);
    	p_dict_list_lbox->Select(0);
    }
    
    void OnDictSelected(wxListEvent& event);
    void OnDictDeselected(wxListEvent& event);
    void OnToolBarFind(wxCommandEvent& event);
    void OnFind(wxCommandEvent& event);

    void OnHtmlLinkClicked(wxHtmlLinkEvent& event);
    
    void OnSplitUnsplit(wxSplitterEvent& event);
    
protected:
	void InitEvents();
	
	int _prev_sash_pos;
	
	DictManager* _p_dictmgr;
	ThemeManager* _p_thememgr;
	ConfigManager* _p_cfgmgr;
};


